﻿@{
    ViewBag.Title = "图片列表";
    Layout = "~/Views/Shared/_Layout_Easyui.cshtml";
}
<div id="image_list_upload_window"></div>
@section Scripts
{
    <script type="text/javascript">
        Oneworks.CreatePage('ImageList', {
            settings: {
                uploadurl: '/Image/Upload'
            },
            controls: {
                uoloadwindow: $('#image_list_upload_window'),
            },
            events: {
                onLoadUpload: function () {
                    var page = Oneworks.page, upload = page['ImageUpload'], list = page['ImageList'];                 
                    upload.events.onSuccess = list.events.onUploadSuccess;
                    upload.events.onFailure = list.events.onUploadFailure;
                },              
                onUploadSuccess: function () {
                    console.log(arguments[0]);
                },
                onUploadFailure: function () {
                    Oneworks.Easyui.alert(arguments[0].Message);
                }
            },
        }, function () {
            var that = this,
                controls = that.controls,
                settings = that.settings,
                events = that.events;
            controls.init = function () {
                controls.uoloadwindow.Easyui().window({
                    title: '图片上传',
                    width: 360,
                    height: 100,
                    href: settings.uploadurl,
                    closed: true,
                    onLoad: events.onLoadUpload
                });

            };
            events.init = function () {
            };
            controls.init();
            events.init();
            controls.uoloadwindow.window('open');
        });
    </script>
}
